package authority.service;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import authority.comm.LayMessage;
import authority.entity.User;
import authority.util.ImprotExcelUtil;

public class ExcelService {
	private UserService service = new UserService();

	public LayMessage importExcel(InputStream in, String fileName) {
		User user = new User();
		user.setId("1");
		List<List<Object>> listob=null;
		try {
			listob = ImprotExcelUtil.getBankListByExcel(in,
					fileName);
		} catch (Exception e) {
			e.printStackTrace();
		}
		List<User> users = new ArrayList<User>();
		for (int i = 0; i < listob.size(); i++) {
			List<Object> ob = listob.get(i);
			User u = new User();
			u.setName(String.valueOf(ob.get(0)));
			u.setPassword("123123");
			u.setRealName(String.valueOf(ob.get(1)));
			u.setBirthday(new Date());

			service.addUser(u, null, user);
		}
		
		return new LayMessage(0, "", null);

	}

}
